package com.example.dto;

import cn.org.atool.fluent.mybatis.annotation.TableId;
import com.example.validator.EnumString;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;

@Data
@Accessors(
        chain = true
)
@EqualsAndHashCode(
        callSuper = false
)
public class UserDTO {

    @TableId(
            value = "id",
            auto = true
    )
    private String id;

    @NotBlank(message = "名字为必填项")
    private String name;

    @NotBlank(message = "性别不能为空")
    @EnumString(value = {"F","M"}, message="性别只允许为F或M")
    private String sex;

    @Range(min = 0, max = 150, message = "年龄介于0-150之间")
    private int age;

    @Email(message = "请填写正确的邮箱地址")
    private String email;
}
